<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      div {
        width: 200px;
        height: 200px;
        background-color: pink;
      }
      .nav {
        color: red;
      }
      .box {
        width: 300px;
        height: 300px;
        background-color: skyblue;
        border: 3px solid red;
        margin: 100px auto;
      }
    </style>
  </head>
  <body>
    <div class="nav">123</div>
    <script>
      const div = document.querySelector('div')
      //会覆盖原来的类名
      // div.className = 'box'
      //想要保留
      // div.className = 'nav box'
    </script>
  </body>
</html>
